Fiber Network
Contents
Fiber Network#
The problem provided in this example is a fiber network with fixed-fixed (both displacement and moments) boundary conditions with a prescribed compressive displacement (i.e. nonhomogenous Dirichlet Boundary Condition) on the top boundary. Each fiber is modeled with 2D geometrically exact beams (i.e. Simo-Reissner Beams). For more information on beams see here.
1%matplotlib inline
2from dolfin import *
3import numpy as np
4import matplotlib.pyplot as plt
5from ufl import diag, Jacobian, shape
6import os
7os.chdir('../..') # change directory to main module directory
8from arc_length.displacement_control_solver import displacement_control # import displacement control formulation of arc-length solver
9
10
11parameters["form_compiler"]["cpp_optimize"] = True
12parameters["form_compiler"]["quadrature_degree"] = 4
13parameters['reorder_dofs_serial'] = False
14
15ffc_options = {"optimize": True, \
16 "eliminate_zeros": True, \
17 "precompute_basis_const": True, \
18 "precompute_ip_const": True}
Import Mesh and define function spaces#
In the case of 2D beams we also define the rotation matrix about the \(z\) axis and directional derivative with respect to the beam centerline.
1mesh = Mesh()
2with XDMFFile(os.getcwd()+'/examples/displacement_control/voronoi.xdmf') as infile:
3 infile.read(mesh)
4
5
6Ue = VectorElement("CG", mesh.ufl_cell(), 2, dim=2) # displacement
7Te = FiniteElement("CG", mesh.ufl_cell(), 1) # rotation
8
9
10V = FunctionSpace(mesh, MixedElement([Ue, Te]))
11
12v_ = TestFunction(V)
13u_, theta_ = split(v_)
14dv = TrialFunction(V)
15v = Function(V, name="Generalized displacement")
16u, theta = split(v)
17
18VR = TensorFunctionSpace(mesh, "DG", 0, shape=(2, 2))
19
20V0 = FunctionSpace(mesh, "DG", 0)
21
22
23Vu = V.sub(0).collapse()
24disp = Function(Vu)
25
26Jac = Jacobian(mesh)
27gdim = mesh.geometry().dim()
28Jac = as_vector([Jac[i, 0] for i in range(gdim)])
29g01 = Jac/sqrt(dot(Jac, Jac))
30g02 = as_vector([-g01[1],g01[0]])
31
32r01 = outer(g01,as_vector([1,0]))
33r02 = outer(g02, as_vector([0,1]))
34
35R0 = r01+r02
36
37#-----------------------Define Functions for beams-----------------------------------#
38def tgrad(u): # directional derivative w.r.t. beam centerline
39 return dot(grad(u), g01)
40
41def rotation_matrix(theta): # 2D rotation matrix -- there is no need to do rotation parametrization for 2D beams
42 return as_tensor([[cos(theta), -sin(theta)],[sin(theta), cos(theta)]])
43Rot = rotation_matrix(theta)
Define Dirichlet Boundary Conditions#
Note that for the case of displacement control, the FEniCS expression for the applied displacement mujst have be positive to prevent convergence issues.
For example:
apply_disp = Expression("t", t = 0.0, degree = 0)
is valid and will not have convergence issues while
apply_disp = Expression("-t", t = 0.0, degree = 0)
can cause convergence issues.
The direction of applied loading will be determined by the initial load step.
1H = 100.0
2w = 100.0
3
4def bottom(x, on_boundary):
5 return near(x[1], 0, 1e-6)
6def top(x, on_boundary):
7 return near(x[1], H,1e-6)
8
9def left(x, on_boundary):
10 return near(x[0], 0,1e-6)
11def right(x, on_boundary):
12 return near(x[0], w,1e-6)
13
14
15BC_bot = DirichletBC(V, Constant((0.0,0.0,0.0)), bottom) # fixed displacement and rotation
16BC_top_x = DirichletBC(V.sub(0).sub(0), Constant(0.0), top) # fix displacement
17BC_top_rot = DirichletBC(V.sub(1), Constant(0.0), top) # fix rotation
18
19apply_disp = Expression("t", t=0.0, degree = 0) # Create expression to compress the top
20BC_top_y = DirichletBC(V.sub(0).sub(1),apply_disp,top) # incrementally compress the top
21
22bcs = [BC_bot, BC_top_y, BC_top_rot, BC_top_x]
0.0
Kinematics and Weak Form#
1# Kinematics: This is "total" beam formulation
2defo = dot(R0.T,dot(Rot.T, g01 + tgrad(u)) - g01)
3curv = tgrad(theta)
1# Geometrical properties
2S = 1.5*3 # cross-sectional area
3I = 3*1.5**3/12 # Area moment
4G = 0.0412 # Shear Modulus
5nu = 0.5
6E = 2*G*(1+nu)
7
8kappa = 5*(1+nu)/(6+5*nu) # Shear correction (Timoshenko)
9
10
11
12# Stiffness moduli
13ES = E*S
14GS = G*kappa*S
15EI = E*I
1# Constitutive Equations
2C_N = diag(as_vector([ES, GS]))
3
4# Applied Load:
5F_max = Constant((0.0,0.0))
6M_max = Constant(0.0)
7
8elastic_energy = 0.5 * (dot(defo, dot(C_N, defo)) + (EI*curv**2))*dx
9
10F_int = derivative(elastic_energy, v, v_)
11F_ext =(-M_max*theta_ + dot(F_max, u_)) * ds
12residual = F_int - F_ext
13tangent_form = derivative(residual, v, dv)
Solver#
To use our solver we first have to define the type of solver (i.e. displacement control or force control) and solver parameters before using the solver. Note that the correct type of solver has to first be imported (see first cell).
Solver parameters#
Here the parameters for both types of solvers:
psi: the scalar arc-legth parameter. Whenpsi= 1, the method becomes the shperical arc-length method and whenpsi= 0 the method becomes the cylindrical arc-length method
tol: tolerance for the linear solver
lmbda0: the initial load parameter
max_iter: maximum number of iterations for the linear solver
solver: (optional): type of linear solver for the FEniCS linear solve function – default FEniCS linear solver is used if no argument is used.
Aside from these solver parameters, the arguments need to solve the FEA problem must also be passed into the solver:
u: the solution function
F_int: First variation of strain energy (internal nodal forces)
F_ext: Externally applied load (external applied force)
J: The Jacobian of the residual with respect to the deformation (tangential stiffness matrix)
displacement_factor: The incremental load factor
The solver can be called by:
solver = force_control(psi,tol,lmbda0,max_iter,u,F_int,F_ext,bcs,J,load_factor,solver)
Using the solver#
Initialize the solver by calling solver.initialize()
Iteratively call solver.solve() until desired stopping condition
1# Solver Parameters
2psi = 1.0
3tol = 1.0e-6
4lmbda0 = -0.5 # negative for compression
5max_iter = 20
6solver = 'mumps'
7
8# Set up arc-length solver
9solver = displacement_control(psi=psi, tol=tol, lmbda0=lmbda0, max_iter=max_iter, u=v,
10 F_int=F_int, F_ext=F_ext, bcs=bcs, J=tangent_form, displacement_factor = apply_disp, solver = solver)
1disp = [v.vector()[:]]
2lmbda = [0]
3# Function space to compute reaction force at each iteration
4v_reac = Function(V)
5bcRy = DirichletBC(V.sub(0).sub(1), Constant(1.0), bottom) # take reaction force from the bottom
6f_reac = [0.0]
7solver.initial_step()
8for ii in range(0,55):
9 solver.solve()
10 if solver.converged:
11 # Store whole displacement field
12 disp.append(v.vector()[:])
13 # Store displacement factor
14 lmbda.append(apply_disp.t)
15 # Compute and store reaction force
16 bcRy.apply(v_reac.vector())
17 f_reac.append(assemble(action(residual,v_reac)))
Starting initial Displacement Control Control with Newton Method:
Iteration 0:
Residual error: 2.7574e+00
Iteration 1:
Residual error: 1.0931e-01
Iteration 2:
Residual error: 1.0057e-02
Iteration 3:
Residual error: 2.8289e-05
Iteration 4:
Residual error: 7.9354e-09
Arc-Length Step 1 :
Iteration: 1
|Total Norm: 7.9354e-09 |Residual Norm: 7.9354e-09 |A: -1.1369e-13|
Arc-Length Step 2 :
Iteration: 1
|Total Norm: 2.9659e-03 |Residual Norm: 1.0128e-03 |A: -2.7876e-03|
Iteration: 2
|Total Norm: 1.3047e-02 |Residual Norm: 2.8949e-07 |A: 1.3047e-02|
Iteration: 3
|Total Norm: 1.2504e-07 |Residual Norm: 1.9003e-12 |A: 1.2504e-07|
Arc-Length Step 3 :
Iteration: 1
|Total Norm: 2.9661e-03 |Residual Norm: 1.0247e-03 |A: -2.7834e-03|
Iteration: 2
|Total Norm: 1.4281e-02 |Residual Norm: 2.9975e-07 |A: 1.4281e-02|
Iteration: 3
|Total Norm: 1.4336e-07 |Residual Norm: 2.0648e-12 |A: 1.4336e-07|
Arc-Length Step 4 :
Iteration: 1
|Total Norm: 2.9665e-03 |Residual Norm: 1.0364e-03 |A: -2.7796e-03|
Iteration: 2
|Total Norm: 1.5652e-02 |Residual Norm: 3.1240e-07 |A: 1.5652e-02|
Iteration: 3
|Total Norm: 1.6604e-07 |Residual Norm: 2.2826e-12 |A: 1.6604e-07|
Arc-Length Step 5 :
Iteration: 1
|Total Norm: 2.9673e-03 |Residual Norm: 1.0480e-03 |A: -2.7761e-03|
Iteration: 2
|Total Norm: 1.7173e-02 |Residual Norm: 3.2775e-07 |A: 1.7173e-02|
Iteration: 3
|Total Norm: 1.9431e-07 |Residual Norm: 2.5696e-12 |A: 1.9431e-07|
Arc-Length Step 6 :
Iteration: 1
|Total Norm: 2.9684e-03 |Residual Norm: 1.0597e-03 |A: -2.7728e-03|
Iteration: 2
|Total Norm: 1.8863e-02 |Residual Norm: 3.4620e-07 |A: 1.8863e-02|
Iteration: 3
|Total Norm: 2.2985e-07 |Residual Norm: 2.9477e-12 |A: 2.2985e-07|
Arc-Length Step 7 :
Iteration: 1
|Total Norm: 2.9699e-03 |Residual Norm: 1.0715e-03 |A: -2.7699e-03|
Iteration: 2
|Total Norm: 2.0742e-02 |Residual Norm: 3.6831e-07 |A: 2.0742e-02|
Iteration: 3
|Total Norm: 2.7497e-07 |Residual Norm: 3.4433e-12 |A: 2.7497e-07|
Arc-Length Step 8 :
Iteration: 1
|Total Norm: 2.9719e-03 |Residual Norm: 1.0836e-03 |A: -2.7673e-03|
Iteration: 2
|Total Norm: 2.2839e-02 |Residual Norm: 3.9505e-07 |A: 2.2839e-02|
Iteration: 3
|Total Norm: 3.3284e-07 |Residual Norm: 4.0900e-12 |A: 3.3284e-07|
Arc-Length Step 9 :
Iteration: 1
|Total Norm: 2.9743e-03 |Residual Norm: 1.0961e-03 |A: -2.7650e-03|
Iteration: 2
|Total Norm: 2.5191e-02 |Residual Norm: 4.2843e-07 |A: 2.5191e-02|
Iteration: 3
|Total Norm: 4.0804e-07 |Residual Norm: 4.9339e-12 |A: 4.0804e-07|
Arc-Length Step 10 :
Iteration: 1
|Total Norm: 2.9774e-03 |Residual Norm: 1.1092e-03 |A: -2.7630e-03|
Iteration: 2
|Total Norm: 2.7847e-02 |Residual Norm: 4.7367e-07 |A: 2.7847e-02|
Iteration: 3
|Total Norm: 5.0735e-07 |Residual Norm: 6.0339e-12 |A: 5.0735e-07|
Arc-Length Step 11 :
Iteration: 1
|Total Norm: 2.9810e-03 |Residual Norm: 1.1232e-03 |A: -2.7613e-03|
Iteration: 2
|Total Norm: 3.0884e-02 |Residual Norm: 5.4663e-07 |A: 3.0884e-02|
Iteration: 3
|Total Norm: 6.4164e-07 |Residual Norm: 7.4790e-12 |A: 6.4164e-07|
Arc-Length Step 12 :
Iteration: 1
|Total Norm: 2.9851e-03 |Residual Norm: 1.1382e-03 |A: -2.7596e-03|
Iteration: 2
|Total Norm: 3.4430e-02 |Residual Norm: 7.0049e-07 |A: 3.4430e-02|
Iteration: 3
|Total Norm: 8.3057e-07 |Residual Norm: 9.4083e-12 |A: 8.3057e-07|
Arc-Length Step 13 :
Iteration: 1
|Total Norm: 2.9899e-03 |Residual Norm: 1.1548e-03 |A: -2.7579e-03|
Iteration: 2
|Total Norm: 3.8739e-02 |Residual Norm: 1.1092e-06 |A: 3.8739e-02|
Iteration: 3
|Total Norm: 1.1172e-06 |Residual Norm: 1.2096e-11 |A: 1.1172e-06|
Iteration: 4
|Total Norm: 6.9830e-13 |Residual Norm: 1.4947e-13 |A: 6.8212e-13|
Arc-Length Step 14 :
Iteration: 1
|Total Norm: 2.9960e-03 |Residual Norm: 1.1734e-03 |A: -2.7567e-03|
Iteration: 2
|Total Norm: 4.4414e-02 |Residual Norm: 2.2946e-06 |A: 4.4414e-02|
Iteration: 3
|Total Norm: 1.6266e-06 |Residual Norm: 1.6362e-11 |A: 1.6266e-06|
Iteration: 4
|Total Norm: 2.2766e-12 |Residual Norm: 1.1429e-13 |A: 2.2737e-12|
Arc-Length Step 15 :
Iteration: 1
|Total Norm: 3.0017e-03 |Residual Norm: 1.1956e-03 |A: -2.7534e-03|
Iteration: 2
|Total Norm: 5.3129e-02 |Residual Norm: 5.8541e-06 |A: 5.3129e-02|
Iteration: 3
|Total Norm: 2.8833e-06 |Residual Norm: 2.9554e-11 |A: 2.8833e-06|
Iteration: 4
|Total Norm: 7.6184e-12 |Residual Norm: 1.4693e-13 |A: 7.6170e-12|
Arc-Length Step 16 :
Iteration: 1
|Total Norm: 3.0082e-03 |Residual Norm: 1.2256e-03 |A: -2.7472e-03|
Iteration: 2
|Total Norm: 6.9990e-02 |Residual Norm: 1.6839e-05 |A: 6.9990e-02|
Iteration: 3
|Total Norm: 8.2898e-06 |Residual Norm: 4.7684e-10 |A: 8.2898e-06|
Iteration: 4
|Total Norm: 1.4404e-10 |Residual Norm: 1.4991e-13 |A: 1.4404e-10|
Arc-Length Step 17 :
Iteration: 1
|Total Norm: 3.0215e-03 |Residual Norm: 1.2846e-03 |A: -2.7348e-03|
Iteration: 2
|Total Norm: 1.0760e-01 |Residual Norm: 4.5691e-05 |A: 1.0760e-01|
Iteration: 3
|Total Norm: 5.3052e-05 |Residual Norm: 1.5780e-08 |A: 5.3052e-05|
Iteration: 4
|Total Norm: 4.3433e-09 |Residual Norm: 7.9411e-13 |A: 4.3433e-09|
Arc-Length Step 18 :
Iteration: 1
|Total Norm: 3.0889e-03 |Residual Norm: 1.4803e-03 |A: -2.7110e-03|
Iteration: 2
|Total Norm: 1.6327e-01 |Residual Norm: 7.1430e-05 |A: 1.6327e-01|
Iteration: 3
|Total Norm: 5.5957e-04 |Residual Norm: 4.1082e-07 |A: 5.5957e-04|
Iteration: 4
|Total Norm: 6.1345e-08 |Residual Norm: 3.1912e-11 |A: 6.1345e-08|
Arc-Length Step 19 :
Iteration: 1
|Total Norm: 3.3845e-03 |Residual Norm: 2.0730e-03 |A: -2.6754e-03|
Iteration: 2
|Total Norm: 1.7563e-01 |Residual Norm: 3.2440e-05 |A: 1.7563e-01|
Iteration: 3
|Total Norm: 1.5515e-03 |Residual Norm: 1.2791e-06 |A: 1.5515e-03|
Iteration: 4
|Total Norm: 2.0392e-09 |Residual Norm: 1.8774e-11 |A: -2.0391e-09|
Arc-Length Step 20 :
Iteration: 1
|Total Norm: 3.8390e-03 |Residual Norm: 2.7833e-03 |A: -2.6441e-03|
Iteration: 2
|Total Norm: 1.5855e-01 |Residual Norm: 5.3816e-06 |A: 1.5855e-01|
Iteration: 3
|Total Norm: 1.5636e-04 |Residual Norm: 7.5967e-08 |A: 1.5636e-04|
Iteration: 4
|Total Norm: 1.9529e-09 |Residual Norm: 2.7601e-13 |A: -1.9529e-09|
Arc-Length Step 21 :
Iteration: 1
|Total Norm: 3.9624e-03 |Residual Norm: 2.9637e-03 |A: -2.6301e-03|
Iteration: 2
|Total Norm: 1.4531e-01 |Residual Norm: 7.1328e-06 |A: 1.4531e-01|
Iteration: 3
|Total Norm: 1.4433e-04 |Residual Norm: 1.1100e-07 |A: 1.4433e-04|
Iteration: 4
|Total Norm: 3.8211e-09 |Residual Norm: 6.0737e-13 |A: -3.8211e-09|
Arc-Length Step 22 :
Iteration: 1
|Total Norm: 3.8358e-03 |Residual Norm: 2.7965e-03 |A: -2.6254e-03|
Iteration: 2
|Total Norm: 1.4389e-01 |Residual Norm: 9.8596e-06 |A: 1.4389e-01|
Iteration: 3
|Total Norm: 2.1917e-04 |Residual Norm: 1.3822e-07 |A: 2.1917e-04|
Iteration: 4
|Total Norm: 4.6416e-09 |Residual Norm: 7.9747e-13 |A: -4.6416e-09|
Arc-Length Step 23 :
Iteration: 1
|Total Norm: 3.6811e-03 |Residual Norm: 2.5859e-03 |A: -2.6198e-03|
Iteration: 2
|Total Norm: 1.5610e-01 |Residual Norm: 9.0604e-06 |A: 1.5610e-01|
Iteration: 3
|Total Norm: 1.4737e-04 |Residual Norm: 7.6994e-08 |A: 1.4737e-04|
Iteration: 4
|Total Norm: 2.7298e-09 |Residual Norm: 3.0982e-13 |A: -2.7298e-09|
Arc-Length Step 24 :
Iteration: 1
|Total Norm: 3.5624e-03 |Residual Norm: 2.4276e-03 |A: -2.6071e-03|
Iteration: 2
|Total Norm: 1.8205e-01 |Residual Norm: 7.8967e-06 |A: 1.8205e-01|
Iteration: 3
|Total Norm: 1.0324e-04 |Residual Norm: 3.8605e-08 |A: 1.0324e-04|
Iteration: 4
|Total Norm: 1.3437e-09 |Residual Norm: 1.8985e-13 |A: -1.3437e-09|
Arc-Length Step 25 :
Iteration: 1
|Total Norm: 3.4804e-03 |Residual Norm: 2.3335e-03 |A: -2.5822e-03|
Iteration: 2
|Total Norm: 2.2342e-01 |Residual Norm: 7.5261e-06 |A: 2.2342e-01|
Iteration: 3
|Total Norm: 1.0844e-04 |Residual Norm: 2.1159e-08 |A: 1.0844e-04|
Iteration: 4
|Total Norm: 5.7867e-10 |Residual Norm: 1.9913e-13 |A: -5.7867e-10|
Arc-Length Step 26 :
Iteration: 1
|Total Norm: 3.4267e-03 |Residual Norm: 2.3005e-03 |A: -2.5397e-03|
Iteration: 2
|Total Norm: 2.8302e-01 |Residual Norm: 8.3987e-06 |A: 2.8302e-01|
Iteration: 3
|Total Norm: 1.6942e-04 |Residual Norm: 1.4681e-08 |A: 1.6942e-04|
Iteration: 4
|Total Norm: 2.0806e-11 |Residual Norm: 2.1400e-13 |A: -2.0805e-11|
Arc-Length Step 27 :
Iteration: 1
|Total Norm: 3.3980e-03 |Residual Norm: 2.3305e-03 |A: -2.4729e-03|
Iteration: 2
|Total Norm: 3.6309e-01 |Residual Norm: 1.0810e-05 |A: 3.6309e-01|
Iteration: 3
|Total Norm: 3.2446e-04 |Residual Norm: 1.7374e-08 |A: 3.2446e-04|
Iteration: 4
|Total Norm: 7.5295e-10 |Residual Norm: 3.5844e-13 |A: 7.5295e-10|
Arc-Length Step 28 :
Iteration: 1
|Total Norm: 3.4011e-03 |Residual Norm: 2.4352e-03 |A: -2.3744e-03|
Iteration: 2
|Total Norm: 4.6299e-01 |Residual Norm: 1.5194e-05 |A: 4.6299e-01|
Iteration: 3
|Total Norm: 6.9045e-04 |Residual Norm: 3.5498e-08 |A: 6.9045e-04|
Iteration: 4
|Total Norm: 2.5974e-09 |Residual Norm: 3.0696e-13 |A: 2.5974e-09|
Arc-Length Step 29 :
Iteration: 1
|Total Norm: 3.4597e-03 |Residual Norm: 2.6401e-03 |A: -2.2359e-03|
Iteration: 2
|Total Norm: 5.7869e-01 |Residual Norm: 2.2407e-05 |A: 5.7869e-01|
Iteration: 3
|Total Norm: 1.6162e-03 |Residual Norm: 8.8407e-08 |A: 1.6162e-03|
Iteration: 4
|Total Norm: 8.6731e-09 |Residual Norm: 3.2002e-13 |A: 8.6731e-09|
Arc-Length Step 30 :
Iteration: 1
|Total Norm: 3.6234e-03 |Residual Norm: 2.9881e-03 |A: -2.0494e-03|
Iteration: 2
|Total Norm: 7.0979e-01 |Residual Norm: 3.3564e-05 |A: 7.0979e-01|
Iteration: 3
|Total Norm: 4.2501e-03 |Residual Norm: 2.4193e-07 |A: 4.2501e-03|
Iteration: 4
|Total Norm: 3.6407e-08 |Residual Norm: 6.2035e-13 |A: 3.6407e-08|
Arc-Length Step 31 :
Iteration: 1
|Total Norm: 3.9794e-03 |Residual Norm: 3.5442e-03 |A: -1.8095e-03|
Iteration: 2
|Total Norm: 8.6723e-01 |Residual Norm: 4.6972e-05 |A: 8.6723e-01|
Iteration: 3
|Total Norm: 1.2028e-02 |Residual Norm: 7.0065e-07 |A: 1.2028e-02|
Iteration: 4
|Total Norm: 1.8739e-07 |Residual Norm: 4.1381e-12 |A: 1.8739e-07|
Arc-Length Step 32 :
Iteration: 1
|Total Norm: 4.6373e-03 |Residual Norm: 4.3807e-03 |A: -1.5211e-03|
Iteration: 2
|Total Norm: 1.0018e+00 |Residual Norm: 5.0774e-05 |A: 1.0018e+00|
Iteration: 3
|Total Norm: 2.6759e-02 |Residual Norm: 1.5164e-06 |A: 2.6759e-02|
Iteration: 4
|Total Norm: 5.0217e-07 |Residual Norm: 5.6539e-12 |A: 5.0217e-07|
Arc-Length Step 33 :
Iteration: 1
|Total Norm: 5.5703e-03 |Residual Norm: 5.4355e-03 |A: -1.2181e-03|
Iteration: 2
|Total Norm: 9.2782e-01 |Residual Norm: 3.8347e-05 |A: 9.2782e-01|
Iteration: 3
|Total Norm: 2.1636e-02 |Residual Norm: 1.0926e-06 |A: 2.1636e-02|
Iteration: 4
|Total Norm: 2.1828e-07 |Residual Norm: 2.7662e-12 |A: 2.1828e-07|
Arc-Length Step 34 :
Iteration: 1
|Total Norm: 6.3133e-03 |Residual Norm: 6.2376e-03 |A: -9.7504e-04|
Iteration: 2
|Total Norm: 7.1135e-01 |Residual Norm: 3.3163e-05 |A: 7.1135e-01|
Iteration: 3
|Total Norm: 4.9782e-04 |Residual Norm: 5.0951e-08 |A: 4.9782e-04|
Iteration: 4
|Total Norm: 2.4119e-09 |Residual Norm: 3.2371e-13 |A: 2.4119e-09|
Arc-Length Step 35 :
Iteration: 1
|Total Norm: 6.3701e-03 |Residual Norm: 6.3135e-03 |A: -8.4698e-04|
Iteration: 2
|Total Norm: 5.7918e-01 |Residual Norm: 4.3131e-05 |A: 5.7918e-01|
Iteration: 3
|Total Norm: 1.1874e-02 |Residual Norm: 5.2585e-07 |A: 1.1874e-02|
Iteration: 4
|Total Norm: 1.5722e-07 |Residual Norm: 9.7343e-12 |A: 1.5722e-07|
Arc-Length Step 36 :
Iteration: 1
|Total Norm: 5.9504e-03 |Residual Norm: 5.8940e-03 |A: -8.1723e-04|
Iteration: 2
|Total Norm: 5.1781e-01 |Residual Norm: 4.4981e-05 |A: 5.1781e-01|
Iteration: 3
|Total Norm: 1.9427e-02 |Residual Norm: 6.4722e-07 |A: 1.9427e-02|
Iteration: 4
|Total Norm: 3.5757e-07 |Residual Norm: 1.4540e-11 |A: 3.5757e-07|
Arc-Length Step 37 :
Iteration: 1
|Total Norm: 5.4563e-03 |Residual Norm: 5.3909e-03 |A: -8.4229e-04|
Iteration: 2
|Total Norm: 5.3008e-01 |Residual Norm: 4.0261e-05 |A: 5.3008e-01|
Iteration: 3
|Total Norm: 2.0081e-02 |Residual Norm: 4.8481e-07 |A: 2.0081e-02|
Iteration: 4
|Total Norm: 3.4566e-07 |Residual Norm: 8.2412e-12 |A: 3.4566e-07|
Arc-Length Step 38 :
Iteration: 1
|Total Norm: 5.0495e-03 |Residual Norm: 4.9699e-03 |A: -8.9274e-04|
Iteration: 2
|Total Norm: 7.6804e-01 |Residual Norm: 3.8347e-05 |A: 7.6804e-01|
Iteration: 3
|Total Norm: 3.0887e-02 |Residual Norm: 6.1893e-07 |A: 3.0887e-02|
Iteration: 4
|Total Norm: 9.7011e-07 |Residual Norm: 1.5269e-11 |A: 9.7011e-07|
Arc-Length Step 39 :
Iteration: 1
|Total Norm: 4.7779e-03 |Residual Norm: 4.6821e-03 |A: -9.5198e-04|
Iteration: 2
|Total Norm: 1.7231e+00 |Residual Norm: 5.3582e-05 |A: 1.7231e+00|
Iteration: 3
|Total Norm: 1.2470e-01 |Residual Norm: 2.8895e-06 |A: 1.2470e-01|
Iteration: 4
|Total Norm: 2.6391e-05 |Residual Norm: 4.9350e-10 |A: 2.6391e-05|
Iteration: 5
|Total Norm: 2.6412e-12 |Residual Norm: 3.7262e-13 |A: 2.6148e-12|
Arc-Length Step 40 :
Iteration: 1
|Total Norm: 4.7783e-03 |Residual Norm: 4.6705e-03 |A: -1.0091e-03|
Iteration: 2
|Total Norm: 5.6691e+00 |Residual Norm: 1.4681e-04 |A: 5.6691e+00|
Iteration: 3
|Total Norm: 2.1858e+00 |Residual Norm: 5.6507e-05 |A: 2.1858e+00|
Iteration: 4
|Total Norm: 1.6539e-02 |Residual Norm: 3.1977e-07 |A: 1.6539e-02|
Iteration: 5
|Total Norm: 4.4466e-06 |Residual Norm: 1.1159e-10 |A: 4.4466e-06|
Iteration: 6
|Total Norm: 3.5515e-12 |Residual Norm: 4.3911e-13 |A: -3.5243e-12|
Arc-Length Step 41 :
Iteration: 1
|Total Norm: 6.5237e-03 |Residual Norm: 6.4444e-03 |A: -1.0141e-03|
Iteration: 2
|Total Norm: 2.4374e+01 |Residual Norm: 6.0962e-04 |A: 2.4374e+01|
Iteration: 3
|Total Norm: 5.7826e+02 |Residual Norm: 1.3583e-02 |A: 5.7826e+02|
Iteration: 4
|Total Norm: 5.5446e+02 |Residual Norm: 1.5843e-03 |A: 5.5446e+02|
Iteration: 5
|Total Norm: 1.1940e+02 |Residual Norm: 7.3897e-04 |A: 1.1940e+02|
Iteration: 6
|Total Norm: 8.7117e+00 |Residual Norm: 1.1961e-04 |A: 8.7117e+00|
Iteration: 7
|Total Norm: 6.4512e-01 |Residual Norm: 3.2217e-06 |A: 6.4512e-01|
Iteration: 8
|Total Norm: 7.4305e-04 |Residual Norm: 6.9167e-09 |A: 7.4305e-04|
Iteration: 9
|Total Norm: 6.9758e-10 |Residual Norm: 3.0433e-13 |A: 6.9758e-10|
Arc-Length Step 42 :
Iteration: 1
|Total Norm: 4.2489e-02 |Residual Norm: 4.2489e-02 |A: -3.2107e-06|
Iteration: 2
|Total Norm: 1.3925e+02 |Residual Norm: 1.8248e-03 |A: 1.3925e+02|
Iteration: 3
|Total Norm: 3.7539e+02 |Residual Norm: 2.7136e-03 |A: 3.7539e+02|
Iteration: 4
|Total Norm: 3.4623e+01 |Residual Norm: 2.4126e-04 |A: 3.4623e+01|
Iteration: 5
|Total Norm: 3.8213e+00 |Residual Norm: 5.2648e-05 |A: 3.8213e+00|
Iteration: 6
|Total Norm: 9.1456e-03 |Residual Norm: 2.8492e-07 |A: 9.1456e-03|
Iteration: 7
|Total Norm: 2.4714e-06 |Residual Norm: 4.6399e-11 |A: 2.4714e-06|
Iteration: 8
|Total Norm: 3.4351e-12 |Residual Norm: 4.0921e-13 |A: 3.4106e-12|
Arc-Length Step 43 :
Iteration: 1
|Total Norm: 1.7128e-02 |Residual Norm: 1.7125e-02 |A: 3.4343e-04|
Iteration: 2
|Total Norm: 7.0157e+00 |Residual Norm: 3.3490e-04 |A: 7.0157e+00|
Iteration: 3
|Total Norm: 2.5615e+01 |Residual Norm: 8.1157e-04 |A: 2.5615e+01|
Iteration: 4
|Total Norm: 4.1739e-01 |Residual Norm: 1.8241e-06 |A: 4.1739e-01|
Iteration: 5
|Total Norm: 3.0797e-04 |Residual Norm: 1.1731e-08 |A: 3.0797e-04|
Iteration: 6
|Total Norm: 1.2983e-10 |Residual Norm: 3.2895e-13 |A: 1.2983e-10|
Arc-Length Step 44 :
Iteration: 1
|Total Norm: 2.6478e-02 |Residual Norm: 2.6477e-02 |A: 2.3096e-04|
Iteration: 2
|Total Norm: 3.9932e+01 |Residual Norm: 9.2623e-04 |A: 3.9932e+01|
Iteration: 3
|Total Norm: 4.7918e+02 |Residual Norm: 1.9028e-02 |A: 4.7918e+02|
Iteration: 4
|Total Norm: 8.1861e+01 |Residual Norm: 1.1336e-03 |A: 8.1861e+01|
Iteration: 5
|Total Norm: 3.7655e+03 |Residual Norm: 1.2781e-01 |A: 3.7655e+03|
Iteration: 6
|Total Norm: 1.0680e+03 |Residual Norm: 3.3649e-02 |A: 1.0680e+03|
Iteration: 7
|Total Norm: 1.1568e+03 |Residual Norm: 2.6388e-02 |A: 1.1568e+03|
Iteration: 8
|Total Norm: 1.8639e+02 |Residual Norm: 1.5776e-03 |A: 1.8639e+02|
Iteration: 9
|Total Norm: 5.7014e+02 |Residual Norm: 2.6124e-02 |A: 5.7014e+02|
Iteration: 10
|Total Norm: 1.2923e+02 |Residual Norm: 1.5790e-03 |A: 1.2923e+02|
Iteration: 11
|Total Norm: 1.3208e+04 |Residual Norm: 2.7083e-01 |A: 1.3208e+04|
Iteration: 12
|Total Norm: 1.5143e+04 |Residual Norm: 2.5223e+00 |A: 1.5143e+04|
Iteration: 13
|Total Norm: 6.7325e+05 |Residual Norm: 9.5718e+00 |A: 6.7325e+05|
Iteration: 14
|Total Norm: 1.5730e+06 |Residual Norm: 1.6983e+03 |A: 1.5730e+06|
Iteration: 15
|Total Norm: 5.0382e+07 |Residual Norm: 1.0176e+04 |A: 5.0382e+07|
Iteration: 16
|Total Norm: 2.6862e+08 |Residual Norm: 6.4986e+05 |A: 2.6862e+08|
Iteration: 17
|Total Norm: 4.1743e+13 |Residual Norm: 3.0267e+08 |A: 4.1743e+13|
Iteration: 18
|Total Norm: 2.5562e+12 |Residual Norm: 5.7333e+09 |A: 2.5562e+12|
Iteration: 19
|Total Norm: 5.1038e+13 |Residual Norm: 5.0752e+11 |A: 5.1036e+13|
Iteration: 20
|Total Norm: 8.5757e+19 |Residual Norm: 3.6198e+15 |A: 8.5757e+19|
Arc-Length Step 44 :
Iteration: 1
|Total Norm: 9.8787e-03 |Residual Norm: 9.8787e-03 |A: 2.8981e-05|
Iteration: 2
|Total Norm: 1.6216e+01 |Residual Norm: 3.4863e-04 |A: 1.6216e+01|
Iteration: 3
|Total Norm: 6.2048e+03 |Residual Norm: 1.8610e-01 |A: 6.2048e+03|
Iteration: 4
|Total Norm: 3.6048e+03 |Residual Norm: 2.9017e-01 |A: 3.6048e+03|
Iteration: 5
|Total Norm: 2.3129e+03 |Residual Norm: 5.8854e-02 |A: 2.3129e+03|
Iteration: 6
|Total Norm: 6.7541e+03 |Residual Norm: 7.8909e-02 |A: 6.7541e+03|
Iteration: 7
|Total Norm: 6.5825e+03 |Residual Norm: 1.2725e-02 |A: 6.5825e+03|
Iteration: 8
|Total Norm: 6.9333e+03 |Residual Norm: 9.8626e-03 |A: 6.9333e+03|
Iteration: 9
|Total Norm: 6.7038e+03 |Residual Norm: 1.2377e-02 |A: 6.7038e+03|
Iteration: 10
|Total Norm: 7.4315e+03 |Residual Norm: 1.1365e-02 |A: 7.4315e+03|
Iteration: 11
|Total Norm: 5.6011e+03 |Residual Norm: 7.7851e-03 |A: 5.6011e+03|
Iteration: 12
|Total Norm: 9.0096e+03 |Residual Norm: 1.7328e-02 |A: 9.0096e+03|
Iteration: 13
|Total Norm: 4.2233e+03 |Residual Norm: 5.6565e-03 |A: 4.2233e+03|
Iteration: 14
|Total Norm: 2.6955e+05 |Residual Norm: 7.2375e-01 |A: 2.6955e+05|
Iteration: 15
|Total Norm: 7.4848e+04 |Residual Norm: 2.4336e+00 |A: 7.4848e+04|
Iteration: 16
|Total Norm: 4.0612e+04 |Residual Norm: 9.1485e+00 |A: 4.0612e+04|
Iteration: 17
|Total Norm: 3.9483e+05 |Residual Norm: 6.6978e+02 |A: 3.9483e+05|
Iteration: 18
|Total Norm: 1.2894e+07 |Residual Norm: 1.0764e+04 |A: 1.2894e+07|
Iteration: 19
|Total Norm: 1.7352e+07 |Residual Norm: 1.8519e+04 |A: 1.7352e+07|
Iteration: 20
|Total Norm: 4.0625e+09 |Residual Norm: 1.9354e+06 |A: 4.0625e+09|
Arc-Length Step 44 :
Iteration: 1
|Total Norm: 1.8410e-03 |Residual Norm: 1.8410e-03 |A: 4.5412e-07|
Iteration: 2
|Total Norm: 1.4363e+03 |Residual Norm: 3.0248e-02 |A: 1.4363e+03|
Iteration: 3
|Total Norm: 8.2299e+02 |Residual Norm: 3.9743e-03 |A: 8.2299e+02|
Iteration: 4
|Total Norm: 5.5395e+02 |Residual Norm: 6.3738e-03 |A: 5.5395e+02|
Iteration: 5
|Total Norm: 4.5045e+02 |Residual Norm: 2.0883e-03 |A: 4.5045e+02|
Iteration: 6
|Total Norm: 5.8541e+02 |Residual Norm: 3.3937e-03 |A: 5.8541e+02|
Iteration: 7
|Total Norm: 6.5836e+04 |Residual Norm: 2.4767e+00 |A: 6.5836e+04|
Iteration: 8
|Total Norm: 6.0452e+04 |Residual Norm: 2.1371e+01 |A: 6.0452e+04|
Iteration: 9
|Total Norm: 1.7186e+05 |Residual Norm: 1.2746e+02 |A: 1.7186e+05|
Iteration: 10
|Total Norm: 7.7505e+07 |Residual Norm: 3.1659e+04 |A: 7.7505e+07|
Iteration: 11
|Total Norm: 1.0890e+08 |Residual Norm: 2.7396e+05 |A: 1.0890e+08|
Iteration: 12
|Total Norm: 3.5284e+10 |Residual Norm: 4.6446e+08 |A: 3.5281e+10|
Iteration: 13
|Total Norm: 4.1869e+12 |Residual Norm: 9.2968e+08 |A: 4.1869e+12|
Iteration: 14
|Total Norm: 7.1727e+14 |Residual Norm: 4.9253e+10 |A: 7.1727e+14|
Iteration: 15
|Total Norm: 1.2688e+14 |Residual Norm: 1.2801e+12 |A: 1.2687e+14|
Iteration: 16
|Total Norm: 6.8164e+17 |Residual Norm: 1.1374e+15 |A: 6.8164e+17|
Iteration: 17
|Total Norm: 2.4592e+18 |Residual Norm: 3.5397e+15 |A: 2.4592e+18|
Iteration: 18
|Total Norm: 4.9029e+19 |Residual Norm: 1.0425e+16 |A: 4.9029e+19|
Iteration: 19
|Total Norm: 1.1258e+21 |Residual Norm: 1.3197e+19 |A: 1.1257e+21|
Iteration: 20
|Total Norm: 3.3567e+22 |Residual Norm: 3.5804e+19 |A: 3.3567e+22|
Arc-Length Step 44 :
Iteration: 1
|Total Norm: 4.2118e-04 |Residual Norm: 4.2118e-04 |A: 7.1008e-09|
Iteration: 2
|Total Norm: 3.5559e-01 |Residual Norm: 9.5015e-06 |A: 3.5559e-01|
Iteration: 3
|Total Norm: 4.0502e-02 |Residual Norm: 1.5713e-06 |A: 4.0502e-02|
Iteration: 4
|Total Norm: 6.0192e-04 |Residual Norm: 2.3409e-08 |A: 6.0192e-04|
Iteration: 5
|Total Norm: 1.4147e-07 |Residual Norm: 5.4817e-12 |A: 1.4147e-07|
Arc-Length Step 45 :
Iteration: 1
|Total Norm: 5.3329e-05 |Residual Norm: 5.3329e-05 |A: 1.4164e-07|
Iteration: 2
|Total Norm: 5.8669e-03 |Residual Norm: 3.6262e-08 |A: 5.8669e-03|
Iteration: 3
|Total Norm: 1.4120e-05 |Residual Norm: 6.2533e-10 |A: 1.4120e-05|
Iteration: 4
|Total Norm: 7.7463e-11 |Residual Norm: 3.8749e-13 |A: 7.7462e-11|
Arc-Length Step 46 :
Iteration: 1
|Total Norm: 1.6901e-04 |Residual Norm: 1.6901e-04 |A: 4.9345e-10|
Iteration: 2
|Total Norm: 7.1834e-02 |Residual Norm: 3.1509e-07 |A: 7.1834e-02|
Iteration: 3
|Total Norm: 5.6205e-04 |Residual Norm: 2.2368e-08 |A: 5.6205e-04|
Iteration: 4
|Total Norm: 3.0918e-08 |Residual Norm: 1.4343e-12 |A: 3.0918e-08|
Arc-Length Step 47 :
Iteration: 1
|Total Norm: 7.1215e-04 |Residual Norm: 7.1215e-04 |A: 1.2335e-07|
Iteration: 2
|Total Norm: 1.4813e+00 |Residual Norm: 5.7291e-06 |A: 1.4813e+00|
Iteration: 3
|Total Norm: 5.2384e-02 |Residual Norm: 1.5121e-06 |A: 5.2384e-02|
Iteration: 4
|Total Norm: 6.6591e-05 |Residual Norm: 3.0026e-09 |A: 6.6591e-05|
Iteration: 5
|Total Norm: 1.9700e-10 |Residual Norm: 3.5812e-13 |A: 1.9700e-10|
Arc-Length Step 48 :
Iteration: 1
|Total Norm: 2.6794e-03 |Residual Norm: 2.6794e-03 |A: -7.4437e-07|
Iteration: 2
|Total Norm: 6.9492e+00 |Residual Norm: 4.9130e-05 |A: 6.9492e+00|
Iteration: 3
|Total Norm: 4.7956e-01 |Residual Norm: 2.6471e-05 |A: 4.7956e-01|
Iteration: 4
|Total Norm: 2.1134e-03 |Residual Norm: 1.0414e-07 |A: 2.1134e-03|
Iteration: 5
|Total Norm: 3.0649e-07 |Residual Norm: 1.3344e-11 |A: 3.0649e-07|
Arc-Length Step 49 :
Iteration: 1
|Total Norm: 6.3885e-03 |Residual Norm: 6.3884e-03 |A: -4.4143e-05|
Iteration: 2
|Total Norm: 6.3327e+00 |Residual Norm: 1.6368e-04 |A: 6.3327e+00|
Iteration: 3
|Total Norm: 3.2740e+00 |Residual Norm: 1.6502e-04 |A: 3.2740e+00|
Iteration: 4
|Total Norm: 3.2804e-02 |Residual Norm: 1.6736e-06 |A: 3.2804e-02|
Iteration: 5
|Total Norm: 5.4937e-05 |Residual Norm: 3.2572e-09 |A: 5.4937e-05|
Iteration: 6
|Total Norm: 2.5384e-11 |Residual Norm: 3.8861e-13 |A: 2.5381e-11|
Arc-Length Step 50 :
Iteration: 1
|Total Norm: 1.0760e-02 |Residual Norm: 1.0739e-02 |A: -6.8104e-04|
Iteration: 2
|Total Norm: 6.2208e+00 |Residual Norm: 2.7804e-04 |A: 6.2208e+00|
Iteration: 3
|Total Norm: 4.8964e+00 |Residual Norm: 3.0539e-04 |A: 4.8964e+00|
Iteration: 4
|Total Norm: 3.6963e-02 |Residual Norm: 2.2955e-06 |A: 3.6963e-02|
Iteration: 5
|Total Norm: 7.8367e-05 |Residual Norm: 5.8645e-09 |A: 7.8367e-05|
Iteration: 6
|Total Norm: 2.8199e-11 |Residual Norm: 5.2711e-13 |A: 2.8194e-11|
Arc-Length Step 51 :
Iteration: 1
|Total Norm: 6.8976e-03 |Residual Norm: 6.8486e-03 |A: -8.2097e-04|
Iteration: 2
|Total Norm: 2.0433e+00 |Residual Norm: 1.2100e-04 |A: 2.0433e+00|
Iteration: 3
|Total Norm: 5.4058e-01 |Residual Norm: 3.9196e-05 |A: 5.4058e-01|
Iteration: 4
|Total Norm: 4.7068e-04 |Residual Norm: 3.1985e-08 |A: 4.7068e-04|
Iteration: 5
|Total Norm: 8.5309e-09 |Residual Norm: 9.3446e-13 |A: 8.5309e-09|
Arc-Length Step 52 :
Iteration: 1
|Total Norm: 5.3022e-03 |Residual Norm: 5.2281e-03 |A: -8.8345e-04|
Iteration: 2
|Total Norm: 5.7150e-01 |Residual Norm: 5.1958e-05 |A: 5.7150e-01|
Iteration: 3
|Total Norm: 4.3710e-02 |Residual Norm: 3.7029e-06 |A: 4.3710e-02|
Iteration: 4
|Total Norm: 3.2986e-06 |Residual Norm: 2.4567e-10 |A: 3.2986e-06|
Iteration: 5
|Total Norm: 4.9140e-12 |Residual Norm: 5.0008e-13 |A: -4.8885e-12|
Post Processing#
Here we plot the final deformed shape and the equilibrium path.
1# Get dof coordinates:
2x_dofs = V.sub(0).sub(0).dofmap().dofs()
3y_dofs = V.sub(0).sub(1).dofmap().dofs()
4theta_dofs = V.sub(1).dofmap().dofs()
5dofs = V.tabulate_dof_coordinates()
6dof_coords = dofs.reshape((-1, 2))
1x_nodal_coord = dof_coords[x_dofs][:,0]
2y_nodal_coord = dof_coords[y_dofs][:,1]
3# Get nodal values
4
5# Plot displacement field
6disp_x = x_nodal_coord + disp[-1][x_dofs]
7disp_y = y_nodal_coord + disp[-1][y_dofs]
8
9plt.figure(figsize=(7,7))
10plt.scatter(disp_x, disp_y, marker = '.', c = 'r', label = 'Deformed Configuration')
11plt.scatter(x_nodal_coord,y_nodal_coord, marker = '.', c = 'k', alpha = 0.3, label = 'Initial Configuration')
12
13plt.xlabel('x-coordinates')
14plt.ylabel('y-coordinates')
15plt.axis('equal')
16plt.show()
1plt.figure(figsize=(7,5))
2plt.plot(-np.array(lmbda), f_reac, c='k', marker = 'o')
3plt.xlabel('Applied Displacement')
4plt.ylabel('Force')
5plt.title('Equilibrium path')
Text(0.5, 1.0, 'Equilibrium path')
Optional: Creating an animation from solution snapshots#
1from matplotlib import animation, rc
2
3plt.rcParams["animation.html"] = "jshtml"
4
5fig = plt.figure(figsize=(7,7))
6ax = fig.add_subplot(111)
7
8ax.set_xlim([0,w])
9ax.set_ylim([-10,H+10])
10
11deformed, = ax.plot([], [], lw = 7, c = 'r', label = 'Deformed Configuration', ls = 'None', marker = '.')
12init, = ax.plot(x_nodal_coord, y_nodal_coord, c='k', lw = 5, ls = 'None', label = 'Initial Configuration', marker = '.', alpha = 0.3)
13ax.legend(loc = 'lower right')
14
15def drawframe(n):
16 disp_x = x_nodal_coord + disp[n][x_dofs]
17 disp_y = y_nodal_coord + disp[n][y_dofs]
18
19 deformed.set_data(disp_x,disp_y)
20 return deformed,
21
22plt.close()
23# blit=True re-draws only the parts that have changed.
24anim = animation.FuncAnimation(fig, drawframe, frames=len(lmbda), interval=40, blit=True)
25
26anim